const path = require('path')
const env = require('./config/env')

module.exports = {
  /*
  ** Headers of the page
  */
  head: {
    title : '易采购-供应端',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' },
      {
        hid: 'description',
        name: 'description',
        content: '易采购'
      }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/ecp-supply/favicon.ico' }
    ]
  },
  css: [
    'element-ui/lib/theme-chalk/index.css',
    '~/assets/sass/index.scss'
  ],
  modules: [
    '@nuxtjs/axios'
  ],
  axios: {
    // withCredentials: true,
    headers: {
      'X-Requested-With': 'XMLHttpRequest'
    },
    proxy: true,
    prefix: '/ecp-supply'
    // See https://github.com/nuxt-community/axios-module#options
  },
  proxy: {
    '/ecp-supply/api': {
      target: (process.env.NODE_ENV === 'pro') ? env.proProxy : env.devProxy,
      pathRewrite: { '^/ecp-supply/api': '' }
    },
    '/ecp-supply/mapapi': {//代理高德地图
      target: 'http://restapi.amap.com/v3',//高德地图api地址
      pathRewrite: { '^/ecp-supply/mapapi': '' }
    },
    '/ecp-supply/apiv1': {
      target:'http://123.56.17.56:8888/ecp-supply',
      pathRewrite: { '^/ecp-supply/apiv1': '' }
    },
  },
  router: {
    base: '/ecp-supply/'
  },
  plugins: [
    '~/plugins/element/element-ui',
    '~/plugins/veeValidate',
    '~/plugins/axios',
    '~/plugins/directive',
  ],
  /*
  ** Customize the progress bar color
  */
  loading : {
    color: '#333856'
  },
  /*
  ** Build configuration
  */
  build: {
    /*
    ** Run ESLint on save
    */
    extend (config, { isDev, isClient }) {
      if (isDev && isClient) {
        config.module.rules.push({
          enforce: 'pre',
          test: /\.(js|vue)$/,
          loader: 'eslint-loader',
          exclude: /(node_modules)/
        })
      }
    }
  }
}
